export default {
  data() {
    return {
      loading: false,
      hasMore: true,
      topStatus: '',
      list: [1, 2, 3, 5, 6, 8, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
    }
  },
  created() {
    console.log('index created');
  },
  activated() {
    console.log('index activated');
  },

  mounted() {
    // 动态添加路由
    // let routes = [{
    //   path: '/mobile/detail',
    //   name: 'detail',
    //   component: () =>
    //     import('@/mobile/views/mycard/page.vue')

    // }];
    // this.$router.addRoutes(routes);
  },

  methods: {
    clickItem() {
      this.$router.push('/mobile/mycard');
    },
    handleTopChange(status) {
      // console.log(status)
    },
    handleBottomChange(status) {
      // console.log(status)
    },
    refresh() {
      console.log('refresh..');
      setTimeout(() => {
        this.list = [1, 2, 3, 5, 6, 8, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25];
        this.$refs.loadmore.onTopLoaded();
      }, 3000);
    },
    loadMore() {
      console.log('loadMore..');
      this.loading = true;
      setTimeout(() => {
        let last = this.list[this.list.length - 1];
        for (let i = 1; i <= 10; i++) {
          this.list.push(last + i);
        }
        this.loading = false;
      }, 2500);
    },
  }
}